#include <string>

/// 类型基类
class Type {
public:
  /// 获取类型id
  virtual inline unsigned int id();
  /// 获取类型名称
  virtual inline std::string name();
  /// 占用空间
  virtual inline unsigned int size();
  /// 对齐字节
  virtual inline unsigned int align();
};

/// 布尔类型
class BooleanType : public Type {
  unsigned int id() override { return 1; }

  std::string name() override { return "bool"; }

  unsigned int size() override { return 1; }

  unsigned int align() override { return 1; }
};

class U8Type : public Type {
  unsigned int id() override { return 11; }

  std::string name() override { return "u8"; }

  unsigned int size() override { return 1; }

  unsigned int align() override { return 1; }
};

class I8Type : public Type {
  unsigned int id() override { return 12; }

  std::string name() override { return "i8"; }

  unsigned int size() override { return 1; }

  unsigned int align() override { return 1; }
};

class U16Type : public Type {
  unsigned int id() override { return 13; }

  std::string name() override { return "u16"; }

  unsigned int size() override { return 2; }

  unsigned int align() override { return 2; }
};

class I16Type : public Type {
  unsigned int id() override { return 14; }

  std::string name() override { return "i16"; }

  unsigned int size() override { return 2; }

  unsigned int align() override { return 2; }
};

class U32Type : public Type {
  unsigned int id() override { return 15; }

  std::string name() override { return "u32"; }

  unsigned int size() override { return 4; }

  unsigned int align() override { return 4; }
};

class I32Type : public Type {
  unsigned int id() override { return 16; }

  std::string name() override { return "i32"; }

  unsigned int size() override { return 4; }

  unsigned int align() override { return 4; }
};

class U64Type : public Type {
  unsigned int id() override { return 17; }

  std::string name() override { return "u64"; }

  unsigned int size() override { return 8; }

  unsigned int align() override { return 8; }
};

class I64Type : public Type {
  unsigned int id() override { return 18; }

  std::string name() override { return "i64"; }

  unsigned int size() override { return 8; }

  unsigned int align() override { return 8; }
};

class U128Type : public Type {
  unsigned int id() override { return 19; }

  std::string name() override { return "u128"; }

  unsigned int size() override { return 16; }

  unsigned int align() override { return 16; }
};

class I128Type : public Type {
  unsigned int id() override { return 20; }

  std::string name() override { return "i128"; }

  unsigned int size() override { return 16; }

  unsigned int align() override { return 16; }
};
